From: Richard M. Stallman Date: Sat, 24 Jan 2004 21:57:57 +0000 (+0000) Subject: (main): Restore errno from saved_errno, X-Git-Tag: archive/raspbian/1%29.2+1-2+rpi1~1^2~24383 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:///%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:/?a=commitdiff_plain;h=464c398c8ae8d665469f448403d9ad4776cdc752;p=emacs.git (main): Restore errno from saved_errno, so the error message comes from socket_status. --- diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c index 49ebada768f..3ae33f72a18 100644 --- a/lib-src/emacsclient.c +++ b/lib-src/emacsclient.c @@ -388,12 +388,14 @@ main (argc, argv) that init_editfns uses to set the global Vuser_full_name. */ char *user_name = (char *) getenv ("LOGNAME"); + if (!user_name) user_name = (char *) getenv ("USER"); if (user_name) { struct passwd *pw = getpwnam (user_name); + if (pw && (pw->pw_uid != geteuid ())) { /* We're running under su, apparently. */ @@ -412,6 +414,8 @@ main (argc, argv) sock_status = socket_status (server.sun_path); saved_errno = errno; } + else + errno = saved_errno; } }